package com.heima.admin.controller.v1;


import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;

import com.heima.model.wemedia.pojos.WmSensitive;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@RequiredArgsConstructor
public class AdSensitiveController {

    private final AdSensitiveService adSensitiveService;

    /**
     * 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id) {
        return adSensitiveService.delete(id);
    }

    /**
     * 敏感词分页查询
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findList(dto);
    }

    /**
     * 保存敏感词
     * @param wmSensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmSensitive wmSensitive) {
        return adSensitiveService.saveSensitive(wmSensitive);
    }

    /**
     * 修改敏感词
     * @param wmSensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive) {
        return adSensitiveService.updateSensitive(wmSensitive);
    }

}
